package com.bondqin.sakila.repository;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import com.bondqin.sakila.entity.Film;

@Repository
public interface FilmDao extends JpaRepository<Film, Integer>, JpaSpecificationExecutor<Film> {

	@Query(value="select a from Film a join a.categories b join a.actors c where b.categoryId = ?1 and c.actorId = ?2")
	public List<Film> queryByCategoryAndActor(Integer categoryId, Integer actorId);
}
